package com.example.myapplication.adapter;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.myapplication.R;

public class MyAdapter extends BaseAdapter {

    Context context;
    String[] username;
    String[] score;
    int[] headImg;

    public MyAdapter(Context context, String[] username, String[] score, int[] headImg) {
        this.context = context;
        this.username = username;
        this.score = score;
        this.headImg = headImg;
    }

    @Override
    public int getCount() {

        return username.length;
    }

    @Override
    public Object getItem(int position) {
        return username[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null){
            convertView = View.inflate(context,R.layout.listview_item_layout,null);
            TextView usernameTv = convertView.findViewById(R.id.username_tv);
            TextView scoreTv = convertView.findViewById(R.id.score_tv);
            usernameTv.setText(username[position] +"");
            scoreTv.setText(score[position] +"");
            ImageView imageTv = convertView.findViewById(R.id.image_tv);


        }
        return convertView;
    }
}
